package com.meilingcloud.research.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meilingcloud.research.domain.RwsFollowTemp;
import com.meilingcloud.research.mapper.RwsFollowTempMapper;
import com.meilingcloud.research.service.IRwsFollowTempService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 随访模板 Service业务层处理
 *
 * @author chenl
 * @date 2021-04-21
 */
@Service
public class RwsFollowTempServiceImpl extends ServiceImpl<RwsFollowTempMapper, RwsFollowTemp> implements IRwsFollowTempService {

    @Override
    public List<RwsFollowTemp> queryList(RwsFollowTemp rwsFollowTemp) {
        LambdaQueryWrapper<RwsFollowTemp> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(rwsFollowTemp.getFollowTempName())) {
            lqw.like(RwsFollowTemp::getFollowTempName, rwsFollowTemp.getFollowTempName());
        }
        if (StringUtils.isNotBlank(rwsFollowTemp.getFollowTempDesc())) {
            lqw.eq(RwsFollowTemp::getFollowTempDesc, rwsFollowTemp.getFollowTempDesc());
        }
        if (rwsFollowTemp.getIntervalTime() != null) {
            lqw.eq(RwsFollowTemp::getIntervalTime, rwsFollowTemp.getIntervalTime());
        }
        if (rwsFollowTemp.getFollowCount() != null) {
            lqw.eq(RwsFollowTemp::getFollowCount, rwsFollowTemp.getFollowCount());
        }
        return this.list(lqw);
    }
}
